<template>
	<view class="container">
		<uni-nav-bar title="商品详情" fixed statusBar :border="false" height="88rpx" left-icon="left" @clickLeft="onClickLeft"></uni-nav-bar>
		<view class="inner">
			<view>
				<text>状态：</text>
				<uni-tag text="正常" type="success" size="small" v-if="storeCommodity.productState == 0" style="color: #fff;"/>
				<uni-tag text="停用" type="warning" size="small" v-else-if="storeCommodity.productState == 1" style="color: #fff;"/>
				<uni-tag text="淘汰" type="error" size="small" v-else style="color: #fff;"/>
				<!-- {{ storeCommodity.productState == 0 ? '正常':storeCommodity.productState == 1 ? '停用':'淘汰'  }} -->
			</view>
			<view><text>类型：</text>{{ storeCommodity.type == 0 ? '整件商品':'拆零商品' }}</view>
			<view><text>名称：</text>{{ storeCommodity.commodityName }}</view>
			<view><text>分类：</text>{{ storeCommodity.categroyName }}</view>
			<view><text>品牌：</text>{{ storeCommodity.brandName }}</view>
			<view><text>产地：</text>{{ storeCommodity.producer }}</view>
			<view><text>条码：</text>{{ storeCommodity.firstCode }}</view>
			<view><text>规格：</text>{{ storeCommodity.standard }}</view>
			<view><text>助记符：</text>{{ storeCommodity.mnemonic }}</view>
			<view><text>大包装：</text>{{ storeCommodity.bigPacking }}</view>
			<view><text>销售单位：</text>{{ storeCommodity.unitName }}</view>
			<view><text>保质期：</text>{{ storeCommodity.expiryNum == '-1' ? '长期':storeCommodity.expiryNum }}</view>
			<view><text>出仓价：</text>{{ storeCommodity.outboundPrice }}元</view>
		</view>
	</view>
</template>

<script>
	import { reqGoodsDetail } from '@/apis/goods.js'
	export default {
		name:"GoodsDetail",
		data() {
			return {
				id: '',
				storeCommodity:{}
			}
		},
		onLoad(params) {
			this.id = params?.id
			this.getGoodsDetail();
		},
		methods: {
			async getGoodsDetail() {
				let res = await reqGoodsDetail({ id: this.id });
				if (res.code === 200) {
					this.storeCommodity = res.data.storeCommodity;
				}
			}
		}
	}
</script>
<style>
	page {
		background: #f7f7f7;
	}
</style>
<style lang="scss" scoped>
	.inner {
		padding: 15rpx 24rpx;
		display: flex;
		flex-wrap: wrap;

		view {
			width: 50%;
			margin-bottom: 35rpx;
			font-size: $uni-font-size-base;
			line-height: 1em;
			word-break: break-all;
			text {
				color: #747474;
			}
		}
	}
</style>